cmake_minimum_required(VERSION 3.16)

project(BioMind_Monitor_System VERSION 0.1 LANGUAGES CXX)

# 启用 Qt 的 MOC、UIC、RCC 等自动处理
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)

# 使用 C++17 标准
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

# 找到 Qt6 所需的组件
find_package(Qt6 REQUIRED COMPONENTS
    Widgets            # 基础的Qt Widgets模块
    Charts             # Qt Charts模块
    Bluetooth          # Qt Bluetooth模块
    Multimedia         # Qt Multimedia多媒体模块
    Sql                # Qt SQL模块
    Network            # Qt Network模块
    SerialPort         # QT 串口模块
    TextToSpeech       # 文字转语音
    PrintSupport       # 报告生成
)

set(PROJECT_SOURCES
    main.cpp
    mainwindow.cpp
    mainwindow.h
    mainwindow.ui
    BioSignalDevice.h BioSignalDevice.cpp
    GSRDevice.h GSRDevice.cpp
    EEGDevice.h EEGDevice.cpp
    ECGDevice.h ECGDevice.cpp
    ChartWidget.h ChartWidget.cpp
    SubjectManagerWidget.h SubjectManagerWidget.cpp
    ChatWidget.h ChatWidget.cpp
    AudioPlayerWidget.h AudioPlayerWidget.cpp
    AnalysisWidget.h AnalysisWidget.cpp
    DatabaseManager.h DatabaseManager.cpp
    TextToSpeechManager.h
    TextToSpeechManager.cpp
    SubjectInfoDialog.h
    SubjectInfoDialog.cpp
    resources/schema.sql
)

# 使用 qt_add_executable 进行 Qt6 项目设置
# 使用 qt_add_executable 进行 Qt6 项目设置
qt_add_executable(BioMind_Monitor_System
    MANUAL_FINALIZATION
    ${PROJECT_SOURCES}
    StatusIndicator.cpp
    StatusIndicator.h
    DeviceMonitorPanel.h
    DeviceMonitorPanel.cpp
    DatabaseWorker.h
    DatabaseWorker.cpp
    resources/logo.png
    ECGDeviceThread.h

    ECGDeviceThread.cpp
    GSRDeviceThread.h
    GSRDeviceThread.cpp
    resources/model_0.png resources/model_1.png resources/model_2.png resources/model_3.png resources/model_female.png resources/model_male.png resources/箭头0.png resources/箭头1.png resources/箭头2.png resources/箭头3.png
    resources.qrc





)

# 将 Qt6 模块链接到目标
target_link_libraries(BioMind_Monitor_System PRIVATE
    Qt6::Widgets
    Qt6::Charts
    Qt6::Bluetooth
    Qt6::Multimedia
    Qt6::Sql
    Qt6::Network
    Qt6::SerialPort
    Qt6::TextToSpeech
    Qt6::PrintSupport
)

# 设置目标属性
set_target_properties(BioMind_Monitor_System PROPERTIES
    MACOSX_BUNDLE_GUI_IDENTIFIER com.example.BioMind_Monitor_System
    MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
    MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
    MACOSX_BUNDLE TRUE
    WIN32_EXECUTABLE TRUE
)

# 安装目标
include(GNUInstallDirs)
install(TARGETS BioMind_Monitor_System
    BUNDLE DESTINATION .
    LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
    RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)

# 完成 Qt6 可执行文件设置
qt_finalize_executable(BioMind_Monitor_System)
